#ifndef SCIN_CTRL_H
#define SCIN_CTRL_H

//#include "afxdlgs.h"
#include "svl.h"
#include "Platform.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "svl_TPostMessage.h"

namespace ant{

class TScinCtrl{
public:
	TScinCtrl(): hWnd(0), Parent(0) {};
    TScinCtrl( HWND _parent );
	
    virtual ~TScinCtrl();
	
    int GetLength();
    int GetLineCount();
    int GetLine( int _line, char *_buff );
    void GetText( char *_buff );
    
    void GotoPos( int _pos ){ SendMessage( SCI_GOTOPOS, _pos ); };
    
    //void AddText( svl::TText &_text );
    void AddLine( svl::TString &_str, int _pos = 0 );
    void Clear();
    void RemoveSelection();
	
    void SetCursorPos( int _line, int _pos );
    void PostCursorPos( int _line, int _pos );

    void ShowWindow(){ ::ShowWindow( hWnd, SW_SHOW ); }
    void HideWindow(){ ::ShowWindow( hWnd, SW_HIDE ); }

    HWND GetHWnd(){ return hWnd; }
    HWND GetParent(){ return Parent; }
    
    virtual void OnNotify( svl::TWindow::TMessage &_message ){};
    int SendMessage(int _message, int _par1=0, int _par2=0);
	
    void GetSelPos(int &_start, int &_end);

	void SetReadOnly( bool ro=false );
	void SetCaretWidth( int width );

	void SetKeywords( svl::TString &kws );
    void SetAStyle(int style, COLORREF fore, COLORREF back=RGB(0xFF, 0xFF, 0xFF)
					, int size=0, const char *face=0);
	
protected:
		
private:
    HWND hWnd;
    HWND Parent;
	
    int (*fn)(void*,int,int,int);
	
    void * ptr;
    int canundo;

    void Init( HWND _parent );

////// TEST PART //////
public:
private:

};

}

#endif